import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/view/mainpage'
    },
    {
      path: '/view',
      component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
      meta: {title: '自述文件'},
      children: [
        {
          path: 'projectManage',
          name:'projectManage',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/Index.vue'),
          meta: {title: '项目管理'}
        },
        {
          path: `project/details/:id`,
          name:'Details',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/Details.vue'),
          meta: {title: '项目详情'}
        },
        {
          path: `project/team/:id`,
          name:'Team',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/teamModule/Team.vue'),
          meta: {title: '项目团队'}
        },
        {
          path: `project/needs/:id`,
          name:'Needs',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/needModule/Needs.vue'),
          meta: {title: '项目需求'}
        },
        {
          path: `project/module/:id`,
          name:'Module',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/moduleModule/Module.vue'),
          meta: {title: '项目模块'}
        },
        {
          path: `project/plan/:id`,
          name:'Plan',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/planModule/Plan.vue'),
          meta: {title: '项目计划'}
        },
        {
          path: `project/testcaseindex/:id`,
          name:'testcaseindex',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/testcase/testCaseIndex.vue'),
          meta: {title: '测试'}
        },
        {
          path: `project/testcase/:id`,
          name:'testcase',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/testcase/testcase.vue'),
          meta: {title: '测试包'}
        },
        {
          path: `project/packTestCase/:id`,
          name:'packTestCase',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/testcase/packTestCase.vue'),
          meta: {title: '测试包的用例'}
        },
        {
          path: `project/packTestCase/record/:id`,
          name:'packTestCaseRecord',
          component: () => import(/* webpackChunkName: "projectManage" */ '../page/ProjectManage/modules/testcase/packTestCaseRecord.vue'),
          meta: {title: '执行记录'}
        },
        // ...[
        //   {title: '项目详情', key: 'Details', name:'Details'},
        //   {title: '项目团队', key: 'Team', name:'Team'},
        //   {title: '项目需求', key: 'Needs', name:'Needs'},
        //   {title: '项目模块', key: 'Module', name:'Module'},
        //   {title: '项目计划', key: 'Plan', name:'Plan'},
        //   // {title: '项目反馈', key: 'Test', name:'Test'},
        //   // {title: '项目文档', key: 'Doc', name:'Doc'},
        //   {title: '项目版本', key: 'Version', name:'Version'},
        //   // {title: '项目统计', key: 'Analysis', name:'Analysis'},
        //   {title: '项目Case', key: 'testcase', name:'项目Case'}
        // ].map(({title, key, name}) => ({
        //   path: `project/${key.toLowerCase()}/:id`,
        //   component: () => import(/* webpackChunkName: "projectModules" */ `../components/page/ProjectManage/modules/${key}.vue`),
        //   meta: {title},
        //   name: name
        // })),
        {
          path: `project/test/:id`,
          name: 'Test',
          component: () => import(/* webpackChunkName: "projectModules" */ `../page/ProjectManage/modules/testModule/Test.vue`),
          meta: {title: '项目反馈'}
        },
        {
          path: `project/testadd/:id`,
          name: 'Test',
          component: () => import(/* webpackChunkName: "projectModules" */ `../page/ProjectManage/modules/testModule/TestAdd.vue`),
          meta: {title: '项目反馈'}
        },
        {
          path: 'orgManage',
          name: 'orgManage',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/orgManage/index.vue'),
          meta: {title: '组织管理'}
        },
        {
          path: 'taskDetail/:id',
          name: 'taskDetail',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/ProjectManage/modules/taskModule/TaskDetail.vue'),
          meta: {title: '任务详情'}
        },
        {
          path: 'taskEdit/:id',
          name: 'taskEdit',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/ProjectManage/modules/task/taskEdit.vue'),
          meta: {title: '修改任务'}
        },
        {
          path: 'project/task/:id',
          name: 'projectTask',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/ProjectManage/modules/taskModule/Task.vue'),
          meta: {title: '任务甘特图'}
        },
        {
          path: `project/needlist/:id`,
          name: 'projectNeedList',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/ProjectManage/modules/need/needList.vue'),
          meta: {title: '全景图'}
        },
        {
          path: `project/neededit`,
          name: 'needEdit',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/ProjectManage/modules/need/needEdit.vue'),
          meta: {title: '编辑需求'}
        },
        {
          path: `project/modelingIndex/:id`,
          name: 'needEdit',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/ProjectManage/modules/need/Modeling/modelingIndex.vue'),
          meta: {title: '建模'}
        },
        {
          path: `project/modelMain/:id`,
          name: 'needEdit',
          component: () => import(/* webpackChunkName: "orgManage" */ '../page/ProjectManage/modules/need/Modeling/modelMain.vue'),
          meta: {title: '建模列表'}
        },
        {
          path: 'test/show/:pid',
          name: 'testShow',
          component: () => import(/* webpackChunkName: "login" */ '../page/ProjectManage/modules/testModule/showTestById.vue'),
          meta: {title: '项目反馈详情'}
        },
        {
          path: 'task/show/:pid',
          name: 'taskShow',
          component: () => import(/* webpackChunkName: "login" */ '../page/ProjectManage/modules/taskModule/showTaskById.vue'),
          meta: {title: '项目任务详情'}
        },
        {
          path: 'dashboard',
          name: 'dashboard',
          component: () => import(/* webpackChunkName: "dashboard" */ '../page/Dashboard.vue'),
          meta: {title: '系统首页'}
        },
        {
          path: 'mainpage',
          name: 'mainpage',
          component: () => import(/* webpackChunkName: "dashboard" */ '../page/MainPage.vue'),
          meta: {title: '主页'}
        },
        {
          path: '404',
          component: () => import(/* webpackChunkName: "404" */ '../page/404.vue'),
          meta: {title: '404'}
        },
        {
          path: '403',
          component: () => import(/* webpackChunkName: "403" */ '../page/403.vue'),
          meta: {title: '403'}
        }
      ]
    },
    {
      path: '/view/login',
      component: () => import(/* webpackChunkName: "login" */ '../page/Login.vue'),
      meta: {title: '登录'}
    },
    // {
    //   path: '*',
    //   redirect: '/view/404'
    // }
  ]
});
